<#assign module="order"/>

<@override name="header">
</@override>
<@override name="body">
<div class="row">
  <div class="col-xs-12 col-md-5">
  	<@shiro.hasPermission name='orderrealtime'>
  	<div class="btn-group">
  		<a href="${ctx}/order/realtime" class="btn btn-danger">
		  <span class="glyphicon glyphicon-time"></span> 时效
		</a>
  	</div>
  	</@shiro.hasPermission>
  	<@shiro.hasPermission name='order'>
  	<div class="btn-group">
	  <a class="btn btn-default" href="${ctx}/order/list">执行中</a>
	  <#assign refusedAmount=Func.refusedOrderAmount()>
	  <a class="btn btn-default" href="${ctx}/order/refuselist">拒单<#if refusedAmount?? && (refusedAmount>0)>-<span id="refuse_label" class="label label-danger">${refusedAmount}</span></#if></a>
	  <a class="btn btn-default active" href="${ctx}/order/cancellist">已销单</a>
	  <a class="btn btn-default" href="${ctx}/order/warmlist">异常订单</a>
	  <a class="btn btn-default" href="${ctx}/order/finishlist">已结算</a>
	  <a class="btn btn-default" href="${ctx}/order/baodanlist">已报单</a>
	</div>
	</@shiro.hasPermission>
  </div>
  
  <div class="col-xs-12 col-md-4">
  	<form class="form-inline" role="form">
	  	<div class="form-group col-xs-9">
	  		<input type="text" class="form-control" style="width:100%;" name="param" value="${param?if_exists}" placeholder="输入订单号、客户电话、服务人员姓名、服务人员电话、目的地">
	  	</div>
	  	<button type="submit" class="btn btn-primary"><i class="icon-search"></i>&nbsp;搜索</button>
  	</form>
  </div>
  
  <div class="col-xs-12 col-md-3">
  	<button class="pull-right btn btn-primary" onclick="window.location.reload(true);"><i class="icon-refresh"></i>&nbsp;刷新</button>
  </div>
</div>
<div class="row margin-top">
	<div class="col-xs-12">
	<div class="panel panel-primary">
	<div class="table-responsive">
		<table class="table table-hover table-striped">
			<thead>
			<tr style="font-size:14px;">
				<th>单号</th>
				<@shiro.isMainCompany>
				<th>所属公司</th>
				</@shiro.isMainCompany>
				<th>类型</th>
				<th>来源</th>
				<th>预约时间</th>
				<th>预约地</th>
				<th>客户姓名</th>
				<th>客户电话</th>
				<th>销单原因</th>
				<th>备注</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
				<#if (page.content)?? >
			  	<#list page.content as data>
				<tr>
					
					<td>
						<a target="_blank" href="${ctx}/order/detail/${data.id}" class="btn-link">***${data.orderNumber?substring(8)}</a>
						<@zhuan>
							<#if data.orderCarType=="daijia">
								<span class="label label-danger status-td">代</span>
							<#elseif data.orderCarType=="zhuanche">
								<span class="label label-warning status-td">专</span>
							</#if>
						</@zhuan>
					</td>
					<@shiro.isMainCompany>
					<td>${data.company.abbreviation?if_exists}</td>
					</@shiro.isMainCompany>
					<td>${data.orderType?if_exists}</td>
					<td>${data.fromSource?if_exists}</td>
					<td>${data.serverTime?string('MM/dd HH:mm')}</td>
					<td style="max-width:250px;">
						${data.fromPlace?if_exists}
					</td>
					<td>${data.clientName?if_exists}</td>
					<td>${data.clientPhone?if_exists}</td>
					<td style="max-width:150px;">
						${data.cancelContent?if_exists}
					</td>
					<td style="max-width:150px;">
						${data.memo?if_exists}
					</td>
					<td>
						<a href="javascript:;" data-value="${data.id}" data-value-memo="${data.memo?if_exists}" class="btn-link memothis">备注</a>
						<a href="javascript:;" class="btn-link" onclick="window.open('${ctx}/order/addmore/${data.id}', '_blank', 'height=770,width=1220,scrollbars=yes,resizable=yes,alwaysRaised=yes,toolbar=no');">追加</a>
					</td>
				</tr>
				</#list>
				</#if>
			</tbody>
		</table>
		<#if page.totalElements??>
		<ul class="pagination pull-right pagination-sm">
			<li><a>共 ${page.totalElements} 条数据</a></li>
			<@pg.pager items=page.totalElements?number maxPageItems=20 export="currentPageNumber=pageNumber" url="${ctx}/order/cancellist">
				<@pg.param name="param" value="${param?if_exists}"/>
				<@pg.index>
					<@pg.first>
						<li><a href="${pageUrl}">&laquo;</a></li>
					</@pg.first>
					<@pg.prev>
						<li><a href="${pageUrl}">&lsaquo;</a></li>
					</@pg.prev>
					<@pg.pages>
						<#if  currentPageNumber == pageNumber >
							<li class="active"><a href="#">${pageNumber}</a></li>
						<#else>
							<li><a href="${pageUrl}">${pageNumber}</a></li>
						</#if>
					</@pg.pages>
					<@pg.next>
						<li><a href="${pageUrl}">&rsaquo;</a></li>
					</@pg.next>
					<@pg.last>
						<li><a href="${pageUrl}">&raquo;</a></li>
					</@pg.last>
				</@pg.index>
			</@pg.pager>
		</ul>
		</#if>
	</div>
	</div>
	</div>
</div>


<form id="memo_form" class="form-horizontal" action="${ctx}/order/memopost" method="post">
<div class="modal fade" id="dialog_memo">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">添加订单备注</h4>
      </div>
      <div class="modal-body">
      	<input type="hidden" name="id" id="dialog_memo_id">
      	<div class="form-group">
            <label class="col-sm-3 control-label">输入新备注：</label>
            <div class="col-sm-9">
                <textarea class="form-control" cols="20" id="dialog_memo_newcontent" name="memo" rows="2" required></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">已有备注：</label>
            <div class="col-sm-9">
                <p class="form-control-static" id="dialog_memo_oldcontent"></p>
            </div>
        </div>
      </div>
      <div class="modal-footer">
    	<button type="button" class="btn btn-primary" id="ok_modal_memo">提交</button>
    	<button type="button" class="btn btn-default" id="close_modal_memo">关闭</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div>
</form>

	
</@override>


<@override name="footer">
	<script type="text/javascript">
		window.daijia = {
			ctx:'${ctx}',
			userId:'<@shiro.principal property='id'/>'
		};
		<#if message??>
			$.scojs_message("${message}", $.scojs_message.TYPE_ERROR);
		</#if>
	</script>
	<script src="${ctx}/assets/js/orderlist.js"></script>
	<script src="${ctx}/assets/js/pushmessage.js"></script>
</@override>
<@extends name="../layout.ftl"/>